package nrpc.client.reqst;

import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.List;
import java.util.function.Consumer;

/**
 * 请求策略
 */
public interface RequestStrategy {

	void invoke(Method method, List<Object> args, Type retType, Consumer<? super Object> callback);
	
	default void asynInvoke(Method method, List<Object> args, Type retType, Consumer<? super Object> callback) {
		new Thread() {
			@Override
			public void run() {
				invoke(method, args, retType, callback);
			}
		}.start();
	}
	
	void close();
	
}
